import {createApp} from 'vue';
import './plugins/assets';
import {setupDayjs, setupIconifyOffline, setupLoading, setupNProgress} from './plugins';
import {setupStore} from './store';
import {setupRouter} from './router';
import {setupI18n} from './locales';
import ElementPlus from 'element-plus' // 引入模块
import 'element-plus/dist/index.css' // 引入css
import "@/components/formdesigner/index.less";
import { setupNaiveUi } from "@/components/formdesigner/ui/naiveUi";

//bpmn工作流绘图工具的样式
import '@/components/bpmnjs/styles/index.scss'
import {createDiscreteApi} from 'naive-ui'
import LucideIcon from '@/components/bpmnjs/components/common/LucideIcon.vue'
import EditItem from '@/components/bpmnjs/components/common/EditItem.vue'
import CollapseTitle from '@/components/bpmnjs/components/common/CollapseTitle.vue'
import App from './App.vue';
import 'virtual:svg-icons-register'
import {setupDesignerExtensions} from "@/components/formdesigner/designer-extensions";

const {message} = createDiscreteApi([
  'message',
])
window.__messageBox = message

async function setupApp() {


  setupLoading();

  setupNProgress();

  setupIconifyOffline();

  setupDayjs();

  setupNaiveUi();

  const app = createApp(App);

  app.component('LucideIcon', LucideIcon)
  app.component('EditItem', EditItem)
  app.component('CollapseTitle', CollapseTitle)
  setupStore(app);

  await setupRouter(app);

  setupI18n(app);

  app.use(ElementPlus);

  setupDesignerExtensions();
  app.mount('#app');
}

setupApp();
